import instance from '@/utils/request'

export function getAdministrator (page, pageSize) {
  return instance.get(`/api/admin/?page=${page}&pageSize=${pageSize}`)
}

export function addAdministrator (form) {
  return instance.post('/api/admin', {
    username: form.username,
    password: form.password,
    jurisdiction: form.jurisdiction ? 1 : 0
  })
}

export function changeAdministrator (form) {
  return instance.put('/api/admin', {
    id: form.id,
    username: form.username,
    password: form.password,
    jurisdiction: form.jurisdiction ? 1 : 0
  })
}

export function deleteAdministrator (idList) {
  const str = '/api/admin/' + idList.map(item => item)
  return instance.delete(str)
}
